$(document).ready(function(e) {
        $(".tab_content").hide();
        $(".tab_content:first").show(); 
        $("ul.tabs li").click(function() {
                $("ul.tabs li").removeClass("active");
                $(this).addClass("active"); 
                $(".tab_content").hide();
                var activeTab = $(this).data("tab");
                $(activeTab).show();
        });       

        var i = null;
        $(".loader").hoverIntent(function() {
                var load = $(this).data("social");
                var social = "#"+load;
                var loader = $(this);
                var comment = "#comment_" + load;
                clearTimeout(i);
                loader.hide();
                $(comment).hide();
        
                $(social).show().mouseleave(function() {
                        clearTimeout(i);
                        i = setTimeout(function() {$(social).hide(); loader.show(); $(comment).show();}, 1000); 
                });
        });

        $("a[rel=external-new-window]").click(function(e){
        e.preventDefault();
                var width = 800;
                var height = 600;
                var url = $(this).attr("href");
                var name = $(this).data("service");             

                var left = (screen.width-width)/2;
                var top = 100;
                var params = "width=" + width + ",height=" + height + ",location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,left=" + left + ",top=" + top;
                window[name] = window.open(url, name, params);
                if(window.focus) {
                        window[name].focus();
                }
                
        });
        
        // Back to top
        $(window).scroll(function() {
            if ($(this).scrollTop()) {
                $('#toTop').fadeIn();
            } else {
                $('#toTop').fadeOut();
            }
        });
        
        $('#toTop').click(function () {
          $('html,body').animate({
            scrollTop: 0
          }, 500);
          return false;
        });

        
        //Commentbox über comments
        
        var yob = $(".comment-replybox-thread").closest(".comment-thread").parent("div").children(".comment-thread").children(".comment-replybox-thread");
        jQuery('.comment-thread ol').before(jQuery(yob));
        
});